From e2e0774656cd71889614e226bbb09e3ee3dd1482 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 27 Oct 2005 18:21:57 +0100 Subject: [PATCH] No side effects in BUG_ON statements in Xen. Signed-off-by: Keir Fraser --- xen/arch/x86/mm.c | 5 ++++- xen/arch/x86/time.c | 6 ++---- xen/common/schedule.c | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index a292bb12f9..5664b88d8a 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1164,6 +1164,7 @@ static int mod_l3_entry(l3_pgentry_t *pl3e, { l3_pgentry_t ol3e; unsigned long vaddr; + int okay; if ( unlikely(!is_guest_l3_slot(pgentry_ptr_to_slot(pl3e))) ) { @@ -1218,7 +1219,9 @@ static int mod_l3_entry(l3_pgentry_t *pl3e, return 0; } - BUG_ON(!create_pae_xen_mappings(pl3e)); + okay = create_pae_xen_mappings(pl3e); + BUG_ON(!okay); + put_page_from_l3e(ol3e, pfn); return 1; } diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index f91c377999..b5f7023bd6 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -323,7 +323,7 @@ static u64 read_pit_count(void) return pit_counter64 + (u16)(pit_stamp - pit_read_counter()); } -static int init_pit(void) +static void init_pit(void) { read_platform_count = read_pit_count; @@ -333,8 +333,6 @@ static int init_pit(void) printk("Platform timer is %s PIT\n", freq_string(CLOCK_TICK_RATE)); using_pit = 1; - - return 1; } /************************************************************ @@ -563,7 +561,7 @@ static void platform_time_calibration(void) static void init_platform_timer(void) { if ( !init_cyclone() && !init_hpet() ) - BUG_ON(!init_pit()); + init_pit(); } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 4c58a8d68e..da344c77db 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -514,7 +514,7 @@ static void dom_timer_fn(void *data) /* Initialise the data structures. */ void __init scheduler_init(void) { - int i; + int i, rc; open_softirq(SCHEDULE_SOFTIRQ, __enter_scheduler); @@ -540,7 +540,9 @@ void __init scheduler_init(void) printk("Using scheduler: %s (%s)\n", ops.name, ops.opt_name); - BUG_ON(SCHED_OP(alloc_task, idle_task[0]) < 0); + rc = SCHED_OP(alloc_task, idle_task[0]); + BUG_ON(rc < 0); + sched_add_domain(idle_task[0]); } -- 2.30.2